entry completion: Avoid critical warnings
authorMatthias Clasen <mclasen@redhat.com>
Mon, 20 Aug 2018 19:15:27 +0000 (19:15 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 20 Aug 2018 19:15:27 +0000 (19:15 +0000)
We must not call move-to-rect unless we have
a transient parent.

gtk/gtkentrycompletion.c

index bf1a7a425c975f757e7847124829260fa1cd6248..acb7f0442503b05e3917c729999a6b17e7a75cb7 100644 (file)
@@ -1461,14 +1461,16 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
       gtk_tree_path_free (path);
     }
 
-  gdk_surface_move_to_rect (_gtk_widget_get_surface (completion->priv->popup_window),
-                            &allocation,
-                            GDK_GRAVITY_SOUTH,
-                            GDK_GRAVITY_NORTH,
-                            GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_SLIDE_X,
-                            0, 0);
-
-  gtk_widget_show (completion->priv->popup_window);
+  if (gtk_window_get_transient_for (GTK_WINDOW (completion->priv->popup_window)))
+    {
+      gdk_surface_move_to_rect (_gtk_widget_get_surface (completion->priv->popup_window),
+                                &allocation,
+                                GDK_GRAVITY_SOUTH,
+                                GDK_GRAVITY_NORTH,
+                                GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_SLIDE_X,
+                                0, 0);
+      gtk_widget_show (completion->priv->popup_window);
+   }
 }
 
 static void